package w9;

public class Example7_6 {
	// 2、不处理，再次表示本方法有可能失败
	static void agentIncom(Bank bank, int in, int out) throws BankException {
		bank.income(in, out);
	}
	
	public static void main(String args[]) {
		Bank bank = new Bank();
		try {
			// 调用有可能失败的方法 
			// 1、try catch
			bank.income(200, -100);
			bank.income(300, -100);
			bank.income(400, -100);
			System.out.printf("银行目前有%d元\n", bank.getMoney());
			bank.income(200, 100);
			bank.income(99999, -100);
		} catch (BankException e) {
			System.out.println("计算收益的过程出现如下问题:");
			System.out.println(e.warnMess());
		}
		System.out.printf("银行目前有%d元\n", bank.getMoney());
	}
}
